3.2.40 \(\int \frac {\tan (a+i \log (x))}{x^2} \, dx\) [140]

Optimal. Leaf size=29 \[ \frac {i}{x}+2 i e^{-i a} \text {ArcTan}\left (e^{-i a} x\right ) \]

[Out]

I/x+2*I*arctan(x/exp(I*a))/exp(I*a)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {4591, 456, 464, 209} \begin {gather*} 2 i e^{-i a} \text {ArcTan}\left (e^{-i a} x\right )+\frac {i}{x} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tan[a + I*Log[x]]/x^2,x]

[Out]

I/x + ((2*I)*ArcTan[x/E^(I*a)])/E^(I*a)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 4591

Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((I - I*E^(2*I*a*d)*
x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps

\begin {align*} \int \frac {\tan (a+i \log (x))}{x^2} \, dx &=\int \frac {\tan (a+i \log (x))}{x^2} \, dx\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.03, size = 44, normalized size = 1.52 \begin {gather*} \frac {i}{x}+2 i \text {ArcTan}(x \cos (a)-i x \sin (a)) \cos (a)+2 \text {ArcTan}(x \cos (a)-i x \sin (a)) \sin (a) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tan[a + I*Log[x]]/x^2,x]

[Out]

I/x + (2*I)*ArcTan[x*Cos[a] - I*x*Sin[a]]*Cos[a] + 2*ArcTan[x*Cos[a] - I*x*Sin[a]]*Sin[a]

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 24, normalized size = 0.83

method result size
risch \(\frac {i}{x}+2 i \arctan \left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{-i a}\) \(24\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(a+I*ln(x))/x^2,x,method=_RETURNVERBOSE)

[Out]

I/x+2*I*arctan(x*exp(-I*a))*exp(-I*a)

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (19) = 38\).
time = 0.52, size = 127, normalized size = 4.38 \begin {gather*} \frac {2 \, x {\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \arctan \left (\frac {2 \, x \cos \left (a\right )}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}, \frac {x^{2} - \cos \left (a\right )^{2} - \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + x {\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \log \left (\frac {x^{2} + \cos \left (a\right )^{2} + 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + 2 i}{2 \, x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="maxima")

[Out]

1/2*(2*x*(-I*cos(a) - sin(a))*arctan2(2*x*cos(a)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2), (x^2 - cos(a)^2 - s
in(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + x*(cos(a) - I*sin(a))*log((x^2 + cos(a)^2 + 2*x*sin(a) +
sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + 2*I)/x

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (19) = 38\).
time = 2.84, size = 39, normalized size = 1.34 \begin {gather*} -\frac {{\left (x \log \left (x + i \, e^{\left (i \, a\right )}\right ) - x \log \left (x - i \, e^{\left (i \, a\right )}\right ) - i \, e^{\left (i \, a\right )}\right )} e^{\left (-i \, a\right )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="fricas")

[Out]

-(x*log(x + I*e^(I*a)) - x*log(x - I*e^(I*a)) - I*e^(I*a))*e^(-I*a)/x

________________________________________________________________________________________

Sympy [A]
time = 0.18, size = 27, normalized size = 0.93 \begin {gather*} \left (\log {\left (x - i e^{i a} \right )} - \log {\left (x + i e^{i a} \right )}\right ) e^{- i a} + \frac {i}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*ln(x))/x**2,x)

[Out]

(log(x - I*exp(I*a)) - log(x + I*exp(I*a)))*exp(-I*a) + I/x

________________________________________________________________________________________

Giac [A]
time = 0.47, size = 28, normalized size = 0.97 \begin {gather*} -\frac {2 \, \arctan \left (\frac {i \, x}{\sqrt {-e^{\left (2 i \, a\right )}}}\right )}{\sqrt {-e^{\left (2 i \, a\right )}}} + \frac {i}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="giac")

[Out]

-2*arctan(I*x/sqrt(-e^(2*I*a)))/sqrt(-e^(2*I*a)) + I/x

________________________________________________________________________________________

Mupad [B]
time = 2.27, size = 27, normalized size = 0.93 \begin {gather*} \frac {\mathrm {atan}\left (\frac {x}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,2{}\mathrm {i}}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}+\frac {1{}\mathrm {i}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(a + log(x)*1i)/x^2,x)

[Out]

(atan(x/exp(a*2i)^(1/2))*2i)/exp(a*2i)^(1/2) + 1i/x

________________________________________________________________________________________